<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <div id="message">尚未收到消息哦</div>
    
    <script src="../../js/jquery-3.2.1.js"></script>
    <script>
        var msgHandle = function (e) {
            $("#message").html("信息：" + e.data);
        }
        if (window.addEventListener) {
            window.addEventListener("message", msgHandle, false);
        } else if (window.attachEvent) {
            window.attachEvent('onmessage', msgHandle);
        }
    </script>
</body>

</html>